
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Code Reviews with Phabricator &mdash; LLVM 3.7 documentation</title>
    
    <link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '3.7',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="LLVM 3.7 documentation" href="index.html" />
    <link rel="prev" title="How To Validate a New Release" href="ReleaseProcess.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head>
  <body role="document">
<div class="logo">
  <a href="index.html">
    <img src="_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="ReleaseProcess.html" title="How To Validate a New Release"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="code-reviews-with-phabricator">
<h1>Code Reviews with Phabricator<a class="headerlink" href="#code-reviews-with-phabricator" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#sign-up" id="id1">Sign up</a></li>
<li><a class="reference internal" href="#requesting-a-review-via-the-command-line" id="id2">Requesting a review via the command line</a></li>
<li><a class="reference internal" href="#requesting-a-review-via-the-web-interface" id="id3">Requesting a review via the web interface</a></li>
<li><a class="reference internal" href="#reviewing-code-with-phabricator" id="id4">Reviewing code with Phabricator</a></li>
<li><a class="reference internal" href="#committing-a-change" id="id5">Committing a change</a></li>
<li><a class="reference internal" href="#abandoning-a-change" id="id6">Abandoning a change</a></li>
<li><a class="reference internal" href="#status" id="id7">Status</a></li>
</ul>
</div>
<p>If you prefer to use a web user interface for code reviews, you can now submit
your patches for Clang and LLVM at <a class="reference external" href="http://reviews.llvm.org">LLVM&#8217;s Phabricator</a> instance.</p>
<p>While Phabricator is a useful tool for some, the relevant -commits mailing list
is the system of record for all LLVM code review. The mailing list should be
added as a subscriber on all reviews, and Phabricator users should be prepared
to respond to free-form comments in mail sent to the commits list.</p>
<div class="section" id="sign-up">
<h2><a class="toc-backref" href="#id1">Sign up</a><a class="headerlink" href="#sign-up" title="Permalink to this headline">¶</a></h2>
<p>To get started with Phabricator, navigate to <a class="reference external" href="http://reviews.llvm.org">http://reviews.llvm.org</a> and
click the power icon in the top right. You can register with a GitHub account,
a Google account, or you can create your own profile.</p>
<p>Make <em>sure</em> that the email address registered with Phabricator is subscribed
to the relevant -commits mailing list. If your are not subscribed to the commit
list, all mail sent by Phabricator on your behalf will be held for moderation.</p>
<p>Note that if you use your Subversion user name as Phabricator user name,
Phabricator will automatically connect your submits to your Phabricator user in
the <a class="reference external" href="http://reviews.llvm.org/diffusion/">Code Repository Browser</a>.</p>
</div>
<div class="section" id="requesting-a-review-via-the-command-line">
<h2><a class="toc-backref" href="#id2">Requesting a review via the command line</a><a class="headerlink" href="#requesting-a-review-via-the-command-line" title="Permalink to this headline">¶</a></h2>
<p>Phabricator has a tool called <em>Arcanist</em> to upload patches from
the command line. To get you set up, follow the
<a class="reference external" href="http://www.phabricator.com/docs/phabricator/article/Arcanist_Quick_Start.html">Arcanist Quick Start</a> instructions.</p>
<p>You can learn more about how to use arc to interact with
Phabricator in the <a class="reference external" href="http://www.phabricator.com/docs/phabricator/article/Arcanist_User_Guide.html">Arcanist User Guide</a>.</p>
</div>
<div class="section" id="requesting-a-review-via-the-web-interface">
<h2><a class="toc-backref" href="#id3">Requesting a review via the web interface</a><a class="headerlink" href="#requesting-a-review-via-the-web-interface" title="Permalink to this headline">¶</a></h2>
<p>The tool to create and review patches in Phabricator is called
<em>Differential</em>.</p>
<p>Note that you can upload patches created through various diff tools,
including git and svn. To make reviews easier, please always include
<strong>as much context as possible</strong> with your diff! Don&#8217;t worry, Phabricator
will automatically send a diff with a smaller context in the review
email, but having the full file in the web interface will help the
reviewer understand your code.</p>
<p>To get a full diff, use one of the following commands (or just use Arcanist
to upload your patch):</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">git</span> <span class="pre">diff</span> <span class="pre">-U999999</span> <span class="pre">other-branch</span></code></li>
<li><code class="docutils literal"><span class="pre">svn</span> <span class="pre">diff</span> <span class="pre">--diff-cmd=diff</span> <span class="pre">-x</span> <span class="pre">-U999999</span></code></li>
</ul>
<p>To upload a new patch:</p>
<ul class="simple">
<li>Click <em>Differential</em>.</li>
<li>Click <em>+ Create Diff</em>.</li>
<li>Paste the text diff or browse to the patch file. Click <em>Create Diff</em>.</li>
<li>Leave the Repository field blank.</li>
<li>Leave the drop down on <em>Create a new Revision...</em> and click <em>Continue</em>.</li>
<li>Enter a descriptive title and summary.  The title and summary are usually
in the form of a <a class="reference internal" href="DeveloperPolicy.html#commit-messages"><span>commit message</span></a>.</li>
<li>Add reviewers and mailing
lists that you want to be included in the review. If your patch is
for LLVM, add llvm-commits as a Subscriber; if your patch is for Clang,
add cfe-commits.</li>
<li>Leave the Repository and Project fields blank.</li>
<li>Click <em>Save</em>.</li>
</ul>
<p>To submit an updated patch:</p>
<ul class="simple">
<li>Click <em>Differential</em>.</li>
<li>Click <em>+ Create Diff</em>.</li>
<li>Paste the updated diff or browse to the updated patch file. Click <em>Create Diff</em>.</li>
<li>Select the review you want to from the <em>Attach To</em> dropdown and click
<em>Continue</em>.</li>
<li>Leave the Repository and Project fields blank.</li>
<li>Add comments about the changes in the new diff. Click <em>Save</em>.</li>
</ul>
</div>
<div class="section" id="reviewing-code-with-phabricator">
<h2><a class="toc-backref" href="#id4">Reviewing code with Phabricator</a><a class="headerlink" href="#reviewing-code-with-phabricator" title="Permalink to this headline">¶</a></h2>
<p>Phabricator allows you to add inline comments as well as overall comments
to a revision. To add an inline comment, select the lines of code you want
to comment on by clicking and dragging the line numbers in the diff pane.
When you have added all your comments, scroll to the bottom of the page and
click the Submit button.</p>
<p>You can add overall comments in the text box at the bottom of the page.
When you&#8217;re done, click the Submit button.</p>
<p>Phabricator has many useful features, for example allowing you to select
diffs between different versions of the patch as it was reviewed in the
<em>Revision Update History</em>. Most features are self descriptive - explore, and
if you have a question, drop by on #llvm in IRC to get help.</p>
<p>Note that as e-mail is the system of reference for code reviews, and some
people prefer it over a web interface, we do not generate automated mail
when a review changes state, for example by clicking &#8220;Accept Revision&#8221; in
the web interface. Thus, please type LGTM into the comment box to accept
a change from Phabricator.</p>
</div>
<div class="section" id="committing-a-change">
<h2><a class="toc-backref" href="#id5">Committing a change</a><a class="headerlink" href="#committing-a-change" title="Permalink to this headline">¶</a></h2>
<p>Arcanist can manage the commit transparently. It will retrieve the description,
reviewers, the <code class="docutils literal"><span class="pre">Differential</span> <span class="pre">Revision</span></code>, etc from the review and commit it to the repository.</p>
<div class="highlight-python"><div class="highlight"><pre>arc patch D&lt;Revision&gt;
arc commit --revision D&lt;Revision&gt;
</pre></div>
</div>
<p>When committing an LLVM change that has been reviewed using
Phabricator, the convention is for the commit message to end with the
line:</p>
<div class="highlight-python"><div class="highlight"><pre>Differential Revision: &lt;URL&gt;
</pre></div>
</div>
<p>where <code class="docutils literal"><span class="pre">&lt;URL&gt;</span></code> is the URL for the code review, starting with
<code class="docutils literal"><span class="pre">http://reviews.llvm.org/</span></code>.</p>
<p>Note that Arcanist will add this automatically.</p>
<p>This allows people reading the version history to see the review for
context.  This also allows Phabricator to detect the commit, close the
review, and add a link from the review to the commit.</p>
</div>
<div class="section" id="abandoning-a-change">
<h2><a class="toc-backref" href="#id6">Abandoning a change</a><a class="headerlink" href="#abandoning-a-change" title="Permalink to this headline">¶</a></h2>
<p>If you decide you should not commit the patch, you should explicitly abandon
the review so that reviewers don&#8217;t think it is still open. In the web UI,
scroll to the bottom of the page where normally you would enter an overall
comment. In the drop-down Action list, which defaults to &#8220;Comment,&#8221; you should
select &#8220;Abandon Revision&#8221; and then enter a comment explaining why. Click the
Submit button to finish closing the review.</p>
</div>
<div class="section" id="status">
<h2><a class="toc-backref" href="#id7">Status</a><a class="headerlink" href="#status" title="Permalink to this headline">¶</a></h2>
<p>Please let us know whether you like it and what could be improved! We&#8217;re still
working on setting up a bug tracker, but you can email klimek-at-google-dot-com
and chandlerc-at-gmail-dot-com and CC the llvm-dev mailing list with questions
until then. We also could use help implementing improvements. This sadly is
really painful and hard because the Phabricator codebase is in PHP and not as
testable as you might like. However, we&#8217;ve put exactly what we&#8217;re deploying up
on an <a class="reference external" href="https://github.com/r4nt/llvm-reviews/">llvm-reviews GitHub project</a> where folks can hack on it and post pull
requests. We&#8217;re looking into what the right long-term hosting for this is, but
note that it is a derivative of an existing open source project, and so not
trivially a good fit for an official LLVM project.</p>
</div>
</div>


          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="ReleaseProcess.html" title="How To Validate a New Release"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2003-2015, LLVM Project.
      Last updated on 2015-09-08.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
    </div>
  </body>
</html>